﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Willow.IRepository;
using Willow.IService;
using Willow.Model;
using Willow.IService.Auth;

namespace Willow.Service.Auth
{
    public class OrganizationService : BaseService<Auth_Organization>, IOrganizationService
    {
        public OrganizationService(IUnitOfWork unitOfWork)
            : base(unitOfWork)
        {
        }

        /// <summary>
        /// 逻辑删除
        /// </summary>
        /// <param name="id">The identifier.</param>
        public void LogicalDelete(Guid id)
        {
            string filterId = id.ToString();
            var lstOrg = base.Filter(p => p.FullParentId.Contains(filterId)).ToList();
            foreach (var org in lstOrg)
            {
                org.IsDelete = true;
            }
            UnitOfWork.SaveChanges();
        }
    }
}
